package com.anyonavinfo.cpaddemo.data.radioinfo.source.local;

import com.anyonavinfo.cpaddemo.data.radioinfo.source.RadioInfoDataSource;

/**
 * Created by ZuiC on 2017/2/8.
 */

public class RadioInfoLocalDataSource implements RadioInfoDataSource {

    private RadioInfoLocalDataSourceHelper radioInfoLocalDataSourceHelper;

    private static RadioInfoLocalDataSource INSTANCE;

    public static RadioInfoLocalDataSource getInstance() {
        if (INSTANCE == null) {
            INSTANCE = new RadioInfoLocalDataSource();
        }
        return INSTANCE;
    }


    private RadioInfoLocalDataSource(){
        radioInfoLocalDataSourceHelper = new RadioInfoLocalDataSourceHelper();
    }

    @Override
    public void saveRadioStation(int position, int frq) {
        radioInfoLocalDataSourceHelper.saveRadioStation(position, frq);
    }

    @Override
    public void loadRadioStation(LoadRadioStation callBack) {
        callBack.onLoadRadioStation(radioInfoLocalDataSourceHelper.readRadioStation());
    }
}
